<?php

namespace Yon\fi;

use \Yon\Lib\Base;
use \Yon\Lib\Tools;

class getAccBody extends Base {

    /**
     * 会计主体查询
     * @return array
     */
    public function getAccBodyByConditions($data){
        $url = "/yonbip/AMP/virtualaccbody/getAccBodyByConditions?access_token=ACCESS_TOKEN";
        $this->registerApi($url, func_get_args());
        $body = json_encode($data,JSON_UNESCAPED_UNICODE);
        $options['headers'][] = "Content-Type:application/json";
        return Tools::json2arr(Tools::post($url,$body,$options));
    }

    /**
     * 获取会计主体下的付款银行
     * @param $data
     * @return mixed
     * @throws \WeChat\Exceptions\InvalidResponseException
     * @throws \WeChat\Exceptions\LocalCacheException
     * @throws \Yon\Exceptions\InvalidResponseException
     * @throws \Yon\Exceptions\LocalCacheException
     */
    public function getAccBank($data)
    {
        $url = "/yonbip/digitalModel/enterprisebank/list?access_token=ACCESS_TOKEN";
        $this->registerApi($url, func_get_args());
        $body = json_encode($data,JSON_UNESCAPED_UNICODE);
        $options['headers'][] = "Content-Type:application/json";
        return Tools::json2arr(Tools::post($url,$body,$options));
    }

    /**
     * 顶级组织查询
     * @param $data
     * @return mixed
     * @throws \WeChat\Exceptions\InvalidResponseException
     * @throws \WeChat\Exceptions\LocalCacheException
     * @throws \Yon\Exceptions\InvalidResponseException
     * @throws \Yon\Exceptions\LocalCacheException
     */
    public function getOrgInfo($data)
    {
        $url = "/yonbip/digitalModel/queryRootOrgInfos?access_token=ACCESS_TOKEN";
        $this->registerApi($url, func_get_args());
        $body = json_encode($data,JSON_UNESCAPED_UNICODE);
        $options['headers'][] = "Content-Type:application/json";
        return Tools::json2arr(Tools::post($url,$body,$options));
    }

    /**
     * 费用项目
     * @param $data
     * @return mixed
     * @throws \WeChat\Exceptions\InvalidResponseException
     * @throws \WeChat\Exceptions\LocalCacheException
     * @throws \Yon\Exceptions\InvalidResponseException
     * @throws \Yon\Exceptions\LocalCacheException
     */
    public function costItem($data)
    {
        $url = "/yonbip/fi/bd/v1/querydata?access_token=ACCESS_TOKEN";
        $this->registerApi($url, func_get_args());
        $body = json_encode($data,JSON_UNESCAPED_UNICODE);
        $options['headers'][] = "Content-Type:application/json";
        return Tools::json2arr(Tools::post($url,$body,$options));
    }

    /**
     * 结算方式
     * @param $data
     * @return mixed
     * @throws \WeChat\Exceptions\InvalidResponseException
     * @throws \WeChat\Exceptions\LocalCacheException
     * @throws \Yon\Exceptions\InvalidResponseException
     * @throws \Yon\Exceptions\LocalCacheException
     */
    public function getBalanceWay($data)
    {
        $url = "/yonbip/digitalModel/settlemethod/tree?access_token=ACCESS_TOKEN";
        $this->registerApi($url, func_get_args());
        $options['headers'][] = "Content-Type:application/json";
        return Tools::json2arr(Tools::post($url,'',$options));
    }

    /**
     * 根据会计主体ID获取部门列表
     * @param $data
     * @return mixed
     * @throws \WeChat\Exceptions\InvalidResponseException
     * @throws \WeChat\Exceptions\LocalCacheException
     * @throws \Yon\Exceptions\InvalidResponseException
     * @throws \Yon\Exceptions\LocalCacheException
     */

    public function getDept($data)
    {
        $url = "/yonbip/digitalModel/admindept/tree?access_token=ACCESS_TOKEN";
        $this->registerApi($url, func_get_args());
        $body = json_encode($data,JSON_UNESCAPED_UNICODE);
        $options['headers'][] = "Content-Type:application/json";
        return Tools::json2arr(Tools::post($url,$body,$options));
    }


    //获取会计要素
    public function getSubjectChart($data)
    {
        $url = "/yonbip/fi/fipub/accsubjectchart/getSubjectChart?access_token=ACCESS_TOKEN";
        $this->registerApi($url, func_get_args());
        $body = json_encode($data,JSON_UNESCAPED_UNICODE);
        $options['headers'][] = "Content-Type:application/json";
        return Tools::json2arr(Tools::post($url,$body,$options));
    }


    /**
     * 根据会计主体获取会计科目
     * @param $data
     * @return mixed
     * @throws \WeChat\Exceptions\InvalidResponseException
     * @throws \WeChat\Exceptions\LocalCacheException
     * @throws \Yon\Exceptions\InvalidResponseException
     * @throws \Yon\Exceptions\LocalCacheException
     */
    public function getSubjectList($data)
    {
        $url = "/yonbip/AMP/fipub/basedoc/querybd/accsubjectByPager?access_token=ACCESS_TOKEN";
        $this->registerApi($url, func_get_args());
        $body = json_encode($data,JSON_UNESCAPED_UNICODE);
        $options['headers'][] = "Content-Type:application/json";
        return Tools::json2arr(Tools::post($url,$body,$options));
    }

    /**
     * 获取凭证类型
     * @param $data
     * @return mixed
     * @throws \WeChat\Exceptions\InvalidResponseException
     * @throws \WeChat\Exceptions\LocalCacheException
     * @throws \Yon\Exceptions\InvalidResponseException
     * @throws \Yon\Exceptions\LocalCacheException
     */
    public function getVoucherType($data)
    {
        $url = "/yonbip/fi/fipub/basedoc/querybd/vouchertype?access_token=ACCESS_TOKEN";
        $this->registerApi($url, func_get_args());
        $body = json_encode($data,JSON_UNESCAPED_UNICODE);
        $options['headers'][] = "Content-Type:application/json";
        return Tools::json2arr(Tools::post($url,$body,$options));
    }

}